<template>
	<view style="">
		<view id="particles" :data-style="particlestyle.style"
		:style="{background:particlestyle.bgcolor,'z-index':particlestyle.zindex,height:pageHeight+'px'}"
		></view>
	</view>
</template>

<script>
	export default {
		name: 'akira-particles',
		props: ['particlestyle'],
		data() {
			return {};
		}
	};
</script>

<script module="test" lang="renderjs">
	import particles from '../../../../uni_modules/aki-particles/static/aki-particles/particles.js';
	export default {
		data() {
			return {
				pageHeight: ''
			};
		},
		mounted() {
			this.pageHeight = uni.getSystemInfoSync().screenHeight;
			//获取dataset
			let dataset = this.$ownerInstance.$el.children[0].dataset;
			//挂载路径是相对www目录而言，和上面import路径起点并不同
			let url = './uni_modules/aki-particles/static/aki-particles/particles-default.json';
			if (dataset?.style) url = './uni_modules/aki-particles/static/aki-particles/particles-' + dataset.style +
				'.json';
			particlesJS.load('particles', url);
		},
	};
</script>
<style>
	#particles {
		position: absolute;
		top: 0rpx;
		background-repeat: no-repeat;
		background-size: cover;
		background-position: 50% 50%;
	}
</style>